package com.shawn.autoconfig;

import com.easemob.im.server.EMProperties;
import com.easemob.im.server.EMService;
import com.shawn.autoconfig.properties.*;
import com.shawn.autoconfig.template.*;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

//SpringBoot自动装配加载SmsProperties
@EnableConfigurationProperties({SmsProperties.class, OssProperties.class, FaceIdProperties.class,
        CMProperties.class, GreenProperties.class,DistributionProperties.class})
public class TouchAutoConfiguration {
    @Bean
    public SmsTemplate smsTemplate(SmsProperties smsProperties){
        //构造注入smsProperties,创建SmsTemplate对象
        return new SmsTemplate(smsProperties);
    }
    @Bean
    public OssTemplate ossTemplate(OssProperties ossProperties){
        return new OssTemplate(ossProperties);
    }

    @Bean
    public FaceIdTemplate faceIdTemplate(FaceIdProperties faceIdProperties){
        return new FaceIdTemplate(faceIdProperties);
    }
    @Bean
    public EMTemplate eMTemplate(CMProperties cmProperties) {
        return new EMTemplate(cmProperties);
    }

    /**
     * 绿色网络
     *
     * @param greenProperties 绿色属性
     * @return {@link GreenTemplate}
     */
    @Bean
  public GreenTemplate greenTemplate(GreenProperties greenProperties){
        return new GreenTemplate(greenProperties);
    }
}
